local config = {
    difftest = false,
    itrace = false,
    clint = false,
    display = true,
    keyboard = true,
}

add_rules("mode.debug", "mode.release", "mode.check")

target("zemu")
    set_languages("cxx17")
    set_kind("binary")
    add_includedirs("include", "/usr/lib/llvm-14/include")
    add_files("src/*/*.cpp")
    add_files("src/*.cpp")
    add_defines("CONFIG_ISA64")
    if config.difftest  then add_defines("CONFIG_DIFFTEST") end
    if config.itrace    then add_defines("CONFIG_ITRACE") end
    if config.clint     then add_defines("CONFIG_CLINT") end
    if config.display   then add_defines("CONFIG_DISPLAY") end
    if config.keyboard  then add_defines("CONFIG_KEYBOARD") end
    add_links("readline", "SDL2")
    set_runargs("--ref=$(projectdir)/spike-diff/build/spike-ref-so", 
                "--img=$(projectdir)/test/nanos-lite-riscv64-npc.bin",
                "--log=$(projectdir)/build/log", "-b")
